var a = getApp();

Page({
    data: {
        page: 1,
        goods_id: "",
        total_page: 0
    },
    onLoad: function(a) {
        a.id && this.setData({
            goods_id: a.id
        }), this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getData: function() {
        var t = this, o = a.getNetAddresss("plugin.auction.api.bid.bid-record"), e = {
            goods_id: t.data.goods_id,
            page: t.data.page
        };
        a._postNetWork({
            url: o,
            data: e,
            success: function(a) {
                var o = a.data;
                1 == o.result ? t.setData({
                    isLoadMore: !0,
                    page: o.data.current_page,
                    total_page: o.data.last_page,
                    info: o.data.data
                }) : wx.showToast({
                    title: o.msg,
                    icon: "none",
                    duration: 1e3
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    getMoreData: function() {
        var t = this;
        if (this.data.isLoadMore = !1, !(this.data.page >= this.data.total_page)) {
            this.data.page += 1;
            var o = a.getNetAddresss("plugin.auction.api.bid.bid-record");
            a._postNetWork({
                url: o,
                data: {
                    goods_id: this.data.goods_id,
                    page: this.data.page
                },
                success: function(a) {
                    var o = a.data;
                    if (t.data.isLoadMore = !0, 1 === o.result) {
                        var e = o.data.data, d = t.data.info.concat(e);
                        t.setData({
                            info: d
                        });
                    } else t.data.page = t.data.page - 1, t.data.isLoadMore = !1;
                }
            });
        }
    }
});